#set the working dir and output dir

working.dir = "/homes/26/jc184963/weather/weather.all.aust/models.04/"
output.dir = "/homes/26/jc184963/weather/weather.all.aust/models.04/"

################################################################################################################################################################
#do something
#set the working directory
setwd(working.dir)

#make a list of species
species = list.files(output.dir)
outdata = NULL
outdata2 = NULL

#cycle through each species
for (spp in species[1:20]) {
#recognise the maxent results file
  weather.area = paste(output.dir,spp,"/weather/output/weather.area.csv",sep="")
  #bring in the maxent results file data
  indata = read.csv(weather.area)
  #calculate standard deviation of austfirefreq # na.rm igrores any no data values
weat1=sd(indata[1:708,3],na.rm=T)
weat2=mean(indata[1:708,3],na.rm=T)
weat3=min(indata[1:708,3],na.rm=T)
weat4=max(indata[1:708,3],na.rm=T)

outdata=cbind(indata[1,],weat.sd=weat1,weat.mean=weat2,weat.min=weat3,weat.max=weat4)

  #recognise the 101st row, but all columns, of the maxent results file, bind the rows
  outdata2 = rbind(outdata2,outdata[1,])
}
    #write out the data
  write.csv(outdata2,"/homes/26/jc184963/weather/weather.all.aust/weather.area.all.spp3.csv",row.names=F)